#!/data/data/com.termux/files/usr/bin/bash
echo "Start>>>"
LINUXFS="linuxname-fs"
LINUXBINDS="linuxname-binds"
HOME="/data/data/com.termux/files/home"
cd $(dirname $0)
unset LD_PRELOAD
command="proot"
command+=" --link2symlink"
command+=" --kill-on-exit"
command+=" -0"
command+=" -r $HOME/$LINUXFS"
if [ -n "$(ls -A $HOME/LINUXBINDS)" ]; then
    for f in $HOME/$LINUXBINDS/* ;do
      . $f
    done
fi
command+=" -b /dev"
command+=" -b /proc"
command+=" -b $HOME/$LINUXBINDS/root:/dev/shm"
command+=" -b /mnt"
command+=" -b /sys"
command+=" -b /proc/mounts:/etc/mtab"
command+=" -b /sdcard"
command+=" -w /root"
command+=" /usr/bin/env -i"
command+=" HOME=/root"
command+=" PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games"
command+=" TERM=$TERM"
command+=" LANG=zh_CN.UTF-8"
command+=" LANGUAGE=zh_CN"
command+=" LC_ALL=zh_CN"
command+=" /bin/bash --login"
command+=" /bin/login"
com="$@"
if [ -z "$1" ];then
    exec $command
else
    $command -c "$com"
fi
clear
echo "Finish<<<"